<template>
 <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <el-form-item label="商品分类">
      <el-select
        v-model="value"
        value-key="_id"
        placeholder="请选择商品分类"
        clearable
        @change="serchType"
      >
        <el-option 
        v-for="item in data"
        :key="item._id"
        :label="item.name"
        :value="item.name"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="分类状态">
      <el-select
       
        placeholder="请选择分类状态"
        clearable
      >
        <el-option label="Zone one" value="shanghai" />
        <el-option label="Zone two" value="beijing" />
      </el-select>
    </el-form-item>

    <el-form-item label="分类名称">
      <el-input v-model="formInline.user" placeholder="请输入分类名称" clearable />
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup lang="ts">
import { reactive,ref } from 'vue'
const formInline = reactive({
  user: '',
  region: '',
  date: '',
})

const onSubmit = () => {
  console.log('submit!')
}
const { data = []} = defineProps<{
    data: any[],
}>();
// 按类型搜索
const serchType=()=>{
  console.log("hhhh");
}
type Option = {
  id: number
  label: string
  desc: string
}
const value = ref<Option>()
</script>

<style scoped>
.demo-form-inline .el-input {
  --el-input-width: 220px;
}

.demo-form-inline .el-select {
  --el-select-width: 220px;
}
</style>